https://glot.io/snippets/ghfyn34508/raw/main.lua